import rxAjax from '@/assets/js/ajax.js';

export const ScreenApi = {};


ScreenApi.baseUrl= '/api-screen/screen/core/public';
ScreenApi.uploadUrl='/api-system/system/core/sysFile/upload';

ScreenApi.getParams=function (setting) {
  let url= ScreenApi.baseUrl + '/getParams';
  return rxAjax.postJson(url,setting);
}

ScreenApi.getConstantItem=function () {
  let url= ScreenApi.baseUrl + '/getConstantItem';
  return rxAjax.get(url);
}

ScreenApi.upload=function(data,callback) {
	let url= ScreenApi.uploadUrl;
	return rxAjax.upload(url,data,callback);
}

//获取服务器地址
ScreenApi.getServerAddress=function() {
	let url="/api-screen/screen/core/screenViewManage/getServerAddress";
	return rxAjax.get(url);
}
//获取大屏列表
ScreenApi.getScreenViewManageList=function(queryParam) {
	let params = {
		'params':queryParam
	}
	let url="/api-screen/screen/core/screenViewManage/getScreenViewManageList";
	return rxAjax.postJson(url,params);
}
//获取分类列表
ScreenApi.getByCatKey=function(params) {
	let url="/api-system/system/core/sysTree/getByCatKey";
	return rxAjax.postUrl(url,params);
}

//获取数据字典
ScreenApi.listDicTree = function (appId){
    let url = '/api-system/system/core/sysTree/listDicTree?appId=' + appId;
    return rxAjax.get(url);
}

//加载自定义查询
ScreenApi.getCustomQueryByKey = function (params){
    let url = '/api-form/form/core/formCustomQuery/getByKey' ;
    return rxAjax.get(url,params);
}

//根据key获取列表
ScreenApi.getListByKey = function (key){
    let url= "/api-form/form/core/formBoList/getByKey?listKey=" + key;
    return rxAjax.get(url);
}

ScreenApi.loadDicByPidAndDicId=function(dicKey,parentId,name) {
    let url= "/api-system/system/core/sysDic/getByPidAndDicId";
    let params={dicKey:dicKey,parentId:parentId,name:name};
    return rxAjax.get(url,params);
}

//获取拼音
ScreenApi.getPinyin=function (name){
    let url= ScreenApi.baseUrl+"/getPinyin";
    let params={chinese:name,lower:true};
    return rxAjax.postForm(url,params);
}


export  default ScreenApi;
